<?php
require "common.php";
$id = $_GET['id'];
$result = mysql_query("select * from `article` where `id`='$id'");
$article = mysql_fetch_assoc($result);
$category_id = $article['category_id'];
$category = mysql_fetch_assoc(mysql_query("select * from `category` where `id`='$category_id'"));

if ($_POST){
    $username = $_POST['username'];
    $content = $_POST['content'];
    $time = time();
 mysql_query ("insert into `comment` (`article_id`,`username`,`content`,`time`) values ('$id','$username','$content','$time') ");

}

require "templates/show.html";